package com.qidian.mes.cal.controller;

import com.qidian.mes.cal.service.CalTeamService;
import com.qidian.mes.pojo.Dict;
import com.qidian.mes.pojo.cal.CalTeam;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author 04冯虹丹
 * @Company 起点编程
 * @Time 2023/10/26 14:32
 * @Description
 */
@RestController
@CrossOrigin
@RequestMapping("/calTeam")
public class CalTeamController {
    @Autowired
    private CalTeamService calTeamService;
    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, CalTeam calTeam){
        return calTeamService.list(page,limit,calTeam);
    }
    @GetMapping("/get")
    public MESResult get(Long teamId){
        System.out.println("1./////////////***********======="+teamId);
        return calTeamService.get(teamId);
    };

    @PostMapping("/save")
    public MESResult save(@RequestBody CalTeam calTeam) {
        return calTeamService.save(calTeam);
    }

    @DeleteMapping("/{teamId}")
    public MESResult deleteByTeamId(@PathVariable Long teamId){
        System.out.println("=============="+teamId);
        return calTeamService.deleteByCalTeamId(teamId);
    }

    @DeleteMapping("/deletes")
    public MESResult deleteByTeamId(Long [] teamId){
        return calTeamService.deleteByTeamIds(teamId);
    }

    @PutMapping("/update")
    public MESResult update(@RequestBody CalTeam calTeam){
        return calTeamService.update(calTeam);
    }

}
